package com.ruoyi.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.domain.WmsWarehouseMaterialMove;
import com.ruoyi.service.IWmsWarehouseMaterialMoveService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 移库信息Controller
 * 
 * @author yinqing
 * @date 2025-06-13
 */
@RestController
@RequestMapping("/warehouse/warehouseMove")
public class WmsWarehouseMaterialMoveController extends BaseController
{
    @Autowired
    private IWmsWarehouseMaterialMoveService wmsWarehouseMaterialMoveService;

    /**
     * 查询移库信息列表
     */
    @PreAuthorize("@ss.hasPermi('warehouse:warehouseMove:list')")
    @GetMapping("/list")
    public TableDataInfo list(WmsWarehouseMaterialMove wmsWarehouseMaterialMove)
    {
        startPage();
        List<WmsWarehouseMaterialMove> list = wmsWarehouseMaterialMoveService.selectWmsWarehouseMaterialMoveList(wmsWarehouseMaterialMove);
        return getDataTable(list);
    }

    /**
     * 导出移库信息列表
     */
    @PreAuthorize("@ss.hasPermi('warehouse:warehouseMove:export')")
    @Log(title = "移库信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, WmsWarehouseMaterialMove wmsWarehouseMaterialMove)
    {
        List<WmsWarehouseMaterialMove> list = wmsWarehouseMaterialMoveService.selectWmsWarehouseMaterialMoveList(wmsWarehouseMaterialMove);
        ExcelUtil<WmsWarehouseMaterialMove> util = new ExcelUtil<WmsWarehouseMaterialMove>(WmsWarehouseMaterialMove.class);
        util.exportExcel(response, list, "移库信息数据");
    }

    /**
     * 获取移库信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('warehouse:warehouseMove:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(wmsWarehouseMaterialMoveService.selectWmsWarehouseMaterialMoveById(id));
    }

    /**
     * 新增移库信息
     */
    @PreAuthorize("@ss.hasPermi('warehouse:warehouseMove:add')")
    @Log(title = "移库信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WmsWarehouseMaterialMove wmsWarehouseMaterialMove)
    {
        return toAjax(wmsWarehouseMaterialMoveService.insertWmsWarehouseMaterialMove(wmsWarehouseMaterialMove));
    }

    /**
     * 修改移库信息
     */
    @PreAuthorize("@ss.hasPermi('warehouse:warehouseMove:edit')")
    @Log(title = "移库信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WmsWarehouseMaterialMove wmsWarehouseMaterialMove)
    {
        return toAjax(wmsWarehouseMaterialMoveService.updateWmsWarehouseMaterialMove(wmsWarehouseMaterialMove));
    }

    /**
     * 删除移库信息
     */
    @PreAuthorize("@ss.hasPermi('warehouse:warehouseMove:remove')")
    @Log(title = "移库信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(wmsWarehouseMaterialMoveService.deleteWmsWarehouseMaterialMoveByIds(ids));
    }
}
